import random
import string
import 实验4
"""#作业1密码验证
result = []

def tlength(pw):
    if (len(pw) > 8):
        return 1
    return 0

def tmix(pw):
    n = 0
    f = {"bw": 0, "lw": 0, "n": 0, "o1": 0, "o2": 0}
    for i in pw:
        if i in string.ascii_uppercase:
            f["bw"] = 1
        elif i in string.ascii_lowercase:
            f["lw"] = 1
        elif i in string.digits:
            f["n"] = 1
        elif i in string.punctuation:
            f["o1"] = 1
        else:
            f["o2"] = 1
    for i in f:
       n += f[i]
    if n >= 3:
        return 1
    return 0

def tc(pw):
    for i in range(len(pw)):
        for j in range(i + 3, len(pw)):
            t = pw[i:j]
            s = pw[j:len(pw)]
            if t in s:
                return 0
    return 1


def end(pw, num, result):
    if tlength(pw) == 0:
        result.append("密码长度等于或少于8位！")
        num += 0
    else:
        num += 1
    if tmix(pw) == 0:
        result.append("密码没有由3种或以上字符组成！")
        num += 0
    else:
        num += 1
    if tc(pw) == 0:
        result.append("密码有长度等于或超过3的子串重复！")
        num += 0
    else:
        num += 1
    return num


pw = input("请输入您的密码：")
num = 2
num = end(pw, num, result)
print(f"{num},{result}")
"""
"""#作业2列表去重，并从大到小排序
list1=random.choices(string.ascii_letters,k=30)
print(list1)
list2=[]
for i in  list1:
     if i not in list2:
         list2.append(i)
list2.sort(reverse=True)
print(list2)
"""
"""#作业3函数内部修改全局变量
i=1
def ab():
  global i
  i=2
ab()
print(i)
"""
#作业4